import request from '@/utils/request'

/* 工单统计接口 */
export const userWork = (start, end) => request.get(`/api/task-service/task/taskReportInfo/${start}/${end}`)

/* 销售统计-订单总数 */
export const orderCount = (start, end) => request.get('/api/order-service/report/orderCount', {
  params: {
    start,
    end
  }
})

/* 销售统计-销售额 */
export const orderAmount = (start, end) => request.get('/api/order-service/report/orderAmount', {
  params: {
    start,
    end
  }
})

/* 商品热榜 */

export const skuTop = (start, end, topValue) => request.get(`/api/order-service/report/skuTop/${topValue}/${start}/${end}`)

/* 销售数据 */
export const amountCollect = (start, end, collectType) => request.get(`/api/order-service/report/amountCollect/${collectType}/${start}/${end}`)
/* 销售额分布 */
export const regionCollect = (start, end) => request.get(`/api/order-service/report/regionCollect/${start}/${end}`)
/* 合作商点位数Top5 */
export const nodeCollect = () => request.get('/api/vm-service/node/nodeCollect')
/* 获取点位总数 */
export const vmCount = () => request.get('/api/vm-service/node/count')
/* 获取合作商总数 */
export const userCount = () => request.get('/api/user-service/partner/count')

// 新增机器
export const addVending = (vmType, nodeId, createUserId) => request.post('/api/vm-service/vm', { vmType, nodeId, createUserId })
// 点位搜索
export const Search = (pageIndex, pageSize) => request.get(`/api/vm-service/node/search?pageIndex=${pageIndex}&pageSize=${pageSize}`)
// 售货机类型搜索
export const vendingType = (pageIndex, pageSize) => request.get(`/api/vm-service/vmType/search?pageIndex=${pageIndex}&pageSize=${pageSize}`)
// 设备管理
export const management = ({ innerCode, pageIndex, pageSize }) => request.get(`/api/vm-service/vm/search?pageIndex=${pageIndex}&pageSize=${pageSize}&innerCode=${innerCode}`)
// 策略搜索
export const strategy = () => request.get('/api/vm-service/policy')
// 应用策略
export const Apply = (innerCodeList, policyId) => request.put('/api/vm-service/vm/applyPolicy', {
  innerCodeList, policyId
})
// 查询售货机策略
export const postStrategy = (innerCode) => request.get(`/api/vm-service/policy/vmPolicy/${innerCode}`)
// 取消策略
export const cancel = (innerCodeList, policyId) => request.put(`/api/vm-service/vm/cancelPolicy/${innerCodeList}/${policyId}`)
// 修改售货机点位
export const Alter = (id, nodeId) => request.put(`/api/vm-service/vm/${id}/${nodeId}`)
/* 区域列表 */
export const reigionList = (data) => request.get('/api/vm-service/region/search', {
  params: data
})

/* 新增区域 */
export const addReigion = (data) => request.post('/api/vm-service/region', data)
/* 删除区域 */
export const delReigion = (id) => request.delete('/api/vm-service/region/' + id)
/* 修改区域 */
export const changeReigion = (id, data) => request.put('/api/vm-service/region/' + id, data)
/* 获取区域详情 */
export const getReigion = (id) => request.get('/api/vm-service/region/' + id)
/* (查看详情) */
export const getSearch = (data) => request.get('/api/vm-service/node/search', {
  params: data
})
